The CV_COORD function converts 2D and 3D coordinates between the rectangular, polar, cylindrical, and spherical coordinate systems.
This routine is written in the IDL language. Its source code can be found in the file cv_coord.pro in the lib subdirectory of the IDL distribution.
Result = CV_COORD( [, /DEGREES] [, /DOUBLE] [, FROM_CYLIN=cyl_coords | , FROM_POLAR=pol_coords | , FROM_RECT=rect_coords | , FROM_SPHERE=sph_coords] [, /TO_CYLIN | , /TO_POLAR | , /TO_RECT | , /TO_SPHERE] )
If the value specified in the “FROM_” keyword is double precision, or if the DOUBLE keyword is set, then all calculations are performed in double precision and the returned value is double precision. Otherwise, single precision is used. If none of the “FROM_” keyword are specified, 0 is returned. If none of the “TO_” keywords are specified, the input coordinates are returned.
This function has no required arguments. All data is passed in via keywords.
If set, then the input and output coordinates are in degrees (where applicable). Otherwise, the angles are in radians.
Set this keyword to force the computation to be done in double-precision arithmetic.
A vector of the form [angle, radius, z], or a (3, n) array of cylindrical coordinates to convert.
A vector of the form [angle, radius], or a (2, n) array of polar coordinates to convert.
A vector of the form [x, y] or [x, y, z], or a (2, n) or (3, n) array containing rectangular coordinates to convert.
A vector of the form [longitude, latitude, radius], or a (3, n) array of spherical coordinates to convert.
If set, cylindrical coordinates are returned in a vector of the form [angle, radius, z], or a (3, n) array.
If set, polar coordinates are returned in a vector of the form [angle, radius], or a (2, n) array.
If set, rectangular coordinates are returned in a vector of the form [x, y] or [x, y, z], or a (2, n) or (3, n) array.
If set, spherical coordinates are returned in a vector of the form [longitude, latitude, radius], or a (3, n) array.
Convert from spherical to cylindrical coordinates:
sph_coord = [[45.0, -60.0, 10.0], [0.0, 0.0, 0.0]]
rect_coord = CV_COORD(FROM_SPHERE=sph_coord, /TO_CYLIN, /DEGREES)
Convert from rectangular to polar coordinates:
rect_coord = [10.0, 10.0]
polar_coord = CV_COORD(FROM_RECT=rect_coord, /TO_POLAR)
Pre 4.0 |
Introduced |